import request from '@/utils/request';
import { ResponseData, SUCCESS_CODE } from '@/utils/types.d';

export async function getWxLoginConfig() {
  const res: ResponseData<{
    ifWxLogin: boolean;
    wxAppId: string;
    wxRedirectUri: string;
  }> = await request('/api/config/v1.0.0/wxlogin');
  if (res?.code === SUCCESS_CODE) {
    return { success: true, data: res.data };
  }
  return {
    success: false,
    data: { ifWxLogin: false, wxAppId: '', wxRedirectUri: '' },
  };
}
